package jmine.tec.web.front.domain;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Transient;

import jmine.tec.persist.annotation.DiscriminatorComment;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

import bancosys.tec.component.Documentation;

/**
 * Back office request value of type big decimal
 * 
 * @author lundberg
 */
@Entity
@DiscriminatorValue("1")
@DiscriminatorComment("NUMERICO")
public class BackOfficeRequestValueBigDecimal extends BackOfficeRequestValue<BigDecimal> {

    /**
     * Constructor
     */
    public BackOfficeRequestValueBigDecimal() {
    }

    /**
     * Constructor
     * 
     * @param property property
     * @param value value
     */
    public BackOfficeRequestValueBigDecimal(BackOfficeRequestProperty property, BigDecimal value) {
        super(property, value);
    }

    /**
     * @return value
     */
    @Column(name = "VL_BIG_DECIMAL", precision = 29, scale = 16)
    @Documentation("VALOR DA PROPRIEDADE DO TIPO NUMERICO.")
    protected BigDecimal getBigDecimalValue() {
        return this.getValue();
    }

    /**
     * @param stringValue the value to set
     */
    protected void setBigDecimalValue(BigDecimal stringValue) {
        this.setValue(stringValue);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    @Transient
    public Criterion getCriteriaExpression() {
        return Restrictions.eq("bigDecimalValue", this.getBigDecimalValue());
    }

}
